//
//  JGTabBarViewController.m
//  WangYLottery
//
//  Created by JJetGu on 15/8/19.
//  Copyright (c) 2015年 JJetGu. All rights reserved.
//

#import "JGTabBarViewController.h"
#import "JGTabBar.h"

@interface JGTabBarViewController ()<JGTabBarDelegate>

@end

@implementation JGTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
   
    // 创建自定义tabBar
    JGTabBar *tabBar = [[JGTabBar alloc] init];
    tabBar.delegate = self;
    tabBar.frame = self.tabBar.bounds;
    
    // 因为系统自动隐藏的是系统自带的tabBar －－－ 所以要加到他的上面
    [self.tabBar addSubview:tabBar];
    
    for (int i = 0; i < self.childViewControllers.count; i++) {
        // 添加底部按钮
        [tabBar addTabBarButtonWithImageName:[NSString stringWithFormat:@"TabBar%d",i + 1] selImageName:[NSString stringWithFormat:@"TabBar%dSel",i + 1]];
    }
}


#pragma mark - JGTabBarDelegate
// 代理方法
-(void)tabBar:(JGTabBar *)tabBar didSelectedIndex:(NSInteger)index
{
    self.selectedIndex = index;
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end
